<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue 3 事件处理</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
 
</head>
<body>
    <div id="app">
        <button @click="handleClick($event, '自定义信息')">点击我</button>
        <p>点击次数：{{ count }}</p>
    </div>

    <script>
        const { createApp, ref } = Vue;

        createApp({
            setup() {
                const count = ref(0);

                function handleClick(event, message) {
                    console.log(event.target); // 访问事件的目标元素
                    console.log(message); // 输出自定义信息
                }

                return { handleClick, count };
            }
        }).mount('#app');
    </script>
</body>
</html>
